home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / ClickNotifier.cpp < prev    next >
Text File  |  1997-08-07  |  2KB  |  62 lines

  1. /*
  2.  *    File:        ClickNotifier.cpp
  3.  *    Function:    A behavior that sends a command to an MCommander when its owner
  4.  *                is clicked.
  5.  *    Written by:    Jesse Jones
  6.  *
  7.  *  Copyright ゥ 1997 Jesse Jones. 
  8.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  9.  *
  10.  *    Change History (most recent first):
  11.  *
  12.  *         <1>     5/04/97    JDJ        Created (from CClickBehavior in TextTraitsDialog.cpp)
  13.  */
  14.  
  15. #include "ClickNotifier.h"
  16.  
  17. #include <ZCommander.h>
  18.  
  19.  
  20. // ===================================================================================
  21. //    class CClickNotifier
  22. // ===================================================================================
  23.  
  24. //---------------------------------------------------------------
  25. //
  26. // CClickNotifier::~CClickNotifier
  27. //
  28. //---------------------------------------------------------------
  29. CClickNotifier::~CClickNotifier()
  30. {
  31. }
  32.  
  33.  
  34. //---------------------------------------------------------------
  35. //
  36. // CClickNotifier::CClickNotifier
  37. //
  38. //---------------------------------------------------------------
  39. CClickNotifier::CClickNotifier(MCommander* notifyee, const string& command)
  40. {
  41.     ASSERT(notifyee != nil);
  42.     ASSERT(command != "");
  43.     
  44.     mNotify = notifyee;
  45.     mCommand = command;
  46. }
  47.  
  48.  
  49. //---------------------------------------------------------------
  50. //
  51. // CClickNotifier::OnExecute
  52. //
  53. //---------------------------------------------------------------
  54. bool CClickNotifier::OnExecute(TMouseEvent& event)
  55. {
  56.     if (event.WasMouseDown())
  57.         mNotify->HandleMenuCommand(mCommand);
  58.         
  59.     return kNotHandled;                            // let the owner handle the click
  60. }
  61.  
  62.